package com.xhcl.web.controller.system;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xhcl.common.annotation.Log;
import com.xhcl.common.enums.BusinessType;
import com.xhcl.system.domain.TSrhsAccountTemp;
import com.xhcl.system.service.ITSrhsAccountTempService;
import com.xhcl.common.core.controller.BaseController;
import com.xhcl.common.core.domain.AjaxResult;
import com.xhcl.framework.uitls.poi.ExcelUtil;
import com.xhcl.common.core.page.TableDataInfo;

/**
 * 账务生成临时数据Controller
 * 
 * @author xhcl
 * @date 2020-09-01
 */
@Controller
@RequestMapping("/system/temp")
public class TSrhsAccountTempController extends BaseController
{
    private String prefix = "system/temp";

    @Autowired
    private ITSrhsAccountTempService tSrhsAccountTempService;

    @RequiresPermissions("system:temp:view")
    @GetMapping()
    public String temp()
    {
        return prefix + "/temp";
    }

    /**
     * 查询账务生成临时数据列表
     */
    @RequiresPermissions("system:temp:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TSrhsAccountTemp tSrhsAccountTemp)
    {   Map<String,Object> map=new HashMap<String,Object>();
        map.put("zbh", 1111);
        map.put("dwbm", "00101");
        map.put("beginsj", new Date());
        map.put("endsj", new Date());
        map.put("outrev", "");
    	tSrhsAccountTempService.callDwdzFunction(map);
    	System.out.println("调用结果打印:"+map.get("outrev"));
        startPage();
        List<TSrhsAccountTemp> list = tSrhsAccountTempService.selectTSrhsAccountTempList(tSrhsAccountTemp);
        return getDataTable(list);
    }

    /**
     * 导出账务生成临时数据列表
     */
    @RequiresPermissions("system:temp:export")
    @Log(title = "账务生成临时数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TSrhsAccountTemp tSrhsAccountTemp)
    {
        List<TSrhsAccountTemp> list = tSrhsAccountTempService.selectTSrhsAccountTempList(tSrhsAccountTemp);
        ExcelUtil<TSrhsAccountTemp> util = new ExcelUtil<TSrhsAccountTemp>(TSrhsAccountTemp.class);
        return util.exportExcel(list, "temp");
    }

}
